﻿using ServoDrivesLib.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ServoDrivesLib.Device
{
    /// <summary>
    /// 清能德创
    /// </summary>
    public class TsinoDynatronControl : ForceModeDeviceControl
    {

        public TsinoDynatronControl(CardControl? servo, int axisId) : base(servo)
        {
            base.AxisId = axisId;
        }

        public override int SetControl(int value)
        {
            int ret = 0;
            ret = servo?.SDOWrite(AxisId + 1, 0x241F, 0, 16, value) ?? -1;
            return ret;
        }
        public override int GetStatus()
        {
            int ret = 0;
            servo?.SDORead(AxisId + 1, 0x2420, 0, 16, ref ret);
            return ret;
        }

        public override int OpenCia402()
        {
           return SetControl(0b0100);
        }

        public override int CloseCia402()
        {
            return SetControl(0b0000);
        }


    }
}
